package gold.enterprise;

import java.util.*;

public class ByteDanceOne {

    public static void printThreeBit(int n) {
        StringBuilder tempThreeStr = new StringBuilder();
        while (n > 0) {
            tempThreeStr.append(String.valueOf(n % 3));
            n /= 3;
        }

        //        System.out.println(tempThreeStr.toString());
        int fibo = 1, prev = 1;
        for (int i = 0; i < tempThreeStr.length(); ++i) {
            if (i + 1 == fibo) {
                System.out.print(tempThreeStr.charAt(i));
                //System.out.println(fibo);
                int temp = fibo;
                fibo = getNextFibo(fibo, prev);
                prev = temp;
            }

        }
    }

    public static int getNextFibo(int cur, int prev) {
        return cur + prev;
    }


    public static void printRoom(int[][] timeList) {
        // timeList 含义：timeList[i][0] 表示学生id，例如1，
        // timeList 含义：timeList[i][1] 表示学生进入时间 start
        // timeList 含义：timeList[i][2] 表示学生进入时间 end

        //比较 o1[1] - o2[1] 通过开始时间做升序排序
        PriorityQueue<int[]> queue = new PriorityQueue(new Comparator() {
            @Override
            public int compare(Object o1, Object o2) {
                int[] arr1 = (int[]) o1;
                int[] arr2 = (int[]) o2;

                return arr1[1] - arr2[1];
            }
        });

        for (int[] timeSlot : timeList) {
            queue.offer(timeSlot);
        }


    }


    public static void main(String[] args) {
        //Scanner in = new Scanner(System.in);
        //int a = in.nextInt();
        //System.out.println(a);

        printThreeBit(1000001);
    }
}
